package scsc.web.xzgl.building.apartment.data;

import java.io.Serializable;

import scsc.pub.data.ExpensesInfo;

public class ExpensesInfoData extends ExpensesInfo implements Serializable {
	String floorName;
	String feeTypeName;
	String feeUnit;
	
	String floorAndFeetp;
	String userName;
	String severyoneFee;

	public ExpensesInfoData() {
		init();
	}

	public ExpensesInfoData(Long feeId,String feeTypeId, String floor, String startDate,
			String endDate, Double price, Double amount,Double amount2, Double totalFee,
			Double everyoneFee, String isnowFee, String userId,
			String latestDate,String floorName,String feeTypeName,String userName)	
	{
		setFeeId(feeId);
		setFeeTypeId(feeTypeId.trim());
		setFloor(floor.trim());
		setStartDate(startDate.substring(0,10));
		setEndDate(endDate.substring(0,10));
		setPrice(price);
		setAmount(amount);
		setTotalFee(totalFee);
		setEveryoneFee(everyoneFee);
		setSeveryoneFee(everyoneFee!=null?everyoneFee.toString():"0.00");
		setIsnowFee(isnowFee.trim());
		setUserId(userId.trim());
		setLatestDate(latestDate.substring(0,10));
		setFloorName(floorName);
		setFeeTypeName(feeTypeName);
		setAmount2(amount2);
		setUserName(userName);
		setFloorAndFeetp(floorName+feeTypeName);

	}

	
	public void reset() {
		init();
	}

	public void init() {
		setFeeId(null);
		setFeeTypeId("");
		setFloor("");
		setStartDate("");
		setEndDate("");
		setPrice(null);
		setAmount(null);
		setTotalFee(null);
		setEveryoneFee(null);
		setSeveryoneFee("0.00");
		setIsnowFee("");
		setUserId("");
		setLatestDate("");
		setFloorName("");
		setFeeTypeName("");		
		//setFeePrice(0);

	}

	public String getFloorName() {
		return floorName;
	}

	public void setFloorName(String floorName) {
		this.floorName = floorName;
	}

	public String getFeeTypeName() {
		return feeTypeName;
	}

	public void setFeeTypeName(String feeTypeName) {
		this.feeTypeName = feeTypeName;
	}

	public String getFeeUnit() {
		return feeUnit;
	}

	public void setFeeUnit(String feeUnit) {
		this.feeUnit = feeUnit;
	}

	public String getFloorAndFeetp() {
		return floorAndFeetp;
	}

	public void setFloorAndFeetp(String floorAndFeetp) {
		this.floorAndFeetp = floorAndFeetp;
	}

	public String getUserName() {
		return userName;
	}

	public void setUserName(String userName) {
		this.userName = userName;
	}

	/*public double getFeePrice() {
		return feePrice;
	}

	public void setFeePrice(double feePrice) {
		this.feePrice = feePrice;
	}*/
	private String getMoneyFormat(String num){
		String formated="";
		if (num.indexOf(".")>=0){
			int index=num.indexOf(".");
			if (index==num.length()-1)
				formated=num+"00";
			else if (index==num.length()-2)
				formated=num+ "0";
			else if (index==num.length()-3)
				formated=num;
			else if (index<num.length()-3)
				formated=num.substring(0,num.indexOf(".")+3);
		}else
			formated=num+".00";
		return formated;
	}

	public String getSeveryoneFee() {
		return severyoneFee;
	}

	public void setSeveryoneFee(String severyoneFee) {
		this.severyoneFee = getMoneyFormat(severyoneFee);
	}

}
